﻿using MediatR;
using Traceability.Commont.Domains.BatchManagementFiles;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;
namespace U.Enterprise.Api.Applications.ReturnWeighing
{
    public class ReturnWeighingBackHandler : IRequestHandler<ReturnWeighingBackCommond, Resqults>
    {


        private readonly IBateRepository<Byproduct> _Byproduct;

        public ReturnWeighingBackHandler(IBateRepository<Byproduct> byproduct)
        {
            _Byproduct = byproduct;
        }

        public async Task<Resqults> Handle(ReturnWeighingBackCommond request, CancellationToken cancellationToken)
        {



            var list = new Resqults() { Code=0};


            var date = _Byproduct.GetAll().Where(x => x.ByproductId == request.XWeightid).FirstOrDefault();




            list.Date = date;


            return list;




        }
    }
}
